<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@page import="com.whjz.dcfs.util.UserUtil"%>
<%@page
	language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="webctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
<title>地图信息</title>
<style type="text/css">
   html, body
   {
       /*margin: 0;
       padding: 0;*/
       font-family :微软雅黑;
   }
   .iw_poi_title
   {
       color: #CC5522;
       font-size: 16px;
       font-weight: bold;
       overflow: hidden;
       padding-right: 13px;
       white-space: nowrap;
   }
   .iw_poi_content
   {
       font: 12px arial,sans-serif;
       overflow: visible;
       padding-top: 4px;
       white-space: -moz-pre-wrap;
       word-wrap: break-word;
   }
   /*table{
   	   margin-top:3px;
   }*/
   .cj_list_td 
   {
	   border:1px solid #3399CC;
	   text-align: center;
	   font-size:12px;
   }
   span{
   	   font-family :微软雅黑;
   	   font-weight:bold;
   	   font-size:15px;
   	   
   	   padding-top:0px;
   	   padding-bottom:0px; 
   	   padding-left:5px;
   	   padding-right:5px;
   }
</style>
<link rel="stylesheet" href="${webctx }/js/ext/resources/css/ext-all.css" type="text/css">
<link rel="stylesheet" href="${webctx }/js/ext/resources/css/xtheme-gray.css" type="text/css">
<script type="text/javascript" src="${webctx }/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.2&services=true"></script>
<script language="JavaScript" src="${webctx }/js/ext/adapter/ext/ext-base.js"></script>
<script language="JavaScript"
	src="${webctx }/js/ext/js/ext-all.js"></script>
</head>
<body>
<div style="border: #ccc 1px solid; width: 100%;
    height: 100%; " id="dituContent">
</div>
<script type="text/javascript">
    var data;
    var xzqh="<%=UserUtil.findUserFromSession(ActionContext.getContext().getSession().get("user"),"getConcern")%>";
    if(xzqh.indexOf("区")!=-1){
    	data=[['-1',xzqh]];
    }else{
    	data= [
				['-1', "全市"],
               ['1', "洪山区"],
               ['2', "武昌区"],
               ['3', "汉阳区"],
               ['4', "桥口区"],
               ['5', "江岸区"],
               ['6', "青山区"],
               ['7', "东西湖区"],
               ['8', "水果湖区"],
               ['9', "江夏区"],
               ['10', "蔡甸区"],
               ['11', "江汉区"],
               ['12', "汉阳区"],
               ['13', "汉南区"],
               ['14', "黄陂区"],
               ['15', "新洲区"],
               ['16', "东湖高新区"]
           ];
    }
    var SB_JBXX_window = new Ext.Window({
        id: "SB_JBXX_Win",
        layout:"fit",
        resizable: false,
        collapsible: false,
        closeAction: "hide",
        action: 'add',
        listeners: {
            hide: function (w) {
                Ext.getCmp("sb_tab").setActiveTab(0); 
                Ext.getCmp("sb_tab").setActiveTab(1);                
            }
        },
        items:[
        	{
        		xtype:"tabpanel",
        		id:"sb_tab",
        		activeTab:0,
        		items:[
					{
						title:'基本信息',
						xtype:"form",
						id:"dcfs_jz_sb_form",
						bodyStyle:'padding:15px 5px 0px 10px',
						defaultType:"displayfield",
						defaults:{anchor:'92%',border:false},
						items:[
							{
								fieldLabel:"设备编号",
								name:"JZ_SB_BH",
								id:"JZ_SB_BH"
							},{
								fieldLabel:"设备名称",
								name:"JZ_SB_MC",
								id:"JZ_SB_MC"
							},{
								 fieldLabel: "设备安装地理位置",
								 name:"JZ_SB_AZWZ",
								 id:"JZ_SB_AZWZ"
							},{
								fieldLabel: "启用时间",
								name:"JZ_SB_QYSJ",
								id:"JZ_SB_QYSJ"
							}, {
								fieldLabel:"运营商信息",
								name:"JZ_YYS_XX",
								id:"JZ_YYS_XX"
							},{
								fieldLabel:"基站环评状态",
								name:"JZ_HP_ZT",
								id:"JZ_HP_ZT"
							}, {
								fieldLabel: "天线架设方式 ",
								name:"JZ_FSTX_JSFS",
								id:"JZ_FSTX_JSFS"
							}, {
								fieldLabel:"环评检测单位",
								name:"JZ_JC_DW",
								id:"JZ_JC_DW"
							},{
								fieldLabel:"环评批复单位",
								name:"JZ_YS_DW",
								id:"JZ_YS_DW"
							}, {
								fieldLabel: "敏感点信息描述",
								name:"JZ_BZ",
								id:"JZ_BZ"
							}
						]
					}, {
						title:'详细信息',
						items:[
							{
								xtype:"form",

								border:false,
								defaults:{border:false,labelWidth:100},
								items:[
									{
										layout:"column",
										defaults:{columnWidth:.5,labelWidth:100,border:false},
										items:[
											{
												layout:"form",
												bodyStyle:'padding:15px 5px 0px 10px',
												defaultType:"displayfield",
												defaults:{anchor:'92%',border:false},
												items:[

													{
														fieldLabel:"设备型号",
														name:"JZ_SB_XH",
														id:"JZ_SB_XH"
													}, {
														fieldLabel: "网络类型",
														name:"JZ_SB_WLLX",
														id:"JZ_SB_WLLX"
													}, {
														fieldLabel:"主要用途",
														name:"YT_MC",
														id:"YT_MC"
													}, {
														fieldLabel: "标称功率(W)",
														name:"JZ_BCGL",
														id:"JZ_BCGL"
													},{
														 fieldLabel: "下行频段1(MHz)",
														 name:"JZ_XXPD_1",
														 id:"JZ_XXPD_1"
													},{
														fieldLabel: "下行频段2(MHz)",
														name:"JZ_XXPD_2",
														id:"JZ_XXPD_2"
													}, {
														fieldLabel:"天线极化方式",
														name:"JZ_FSTX_JHFS",
														id:"JZ_FSTX_JHFS"
													}, {
														fieldLabel: "天线方位角(度)",
														name:"JZ_FSTX_FWJ",
														id:"JZ_FSTX_FWJ"
													}, {
														fieldLabel: "天线下频角(度)",
														name:"JZ_FSTX_XPJ",
														id:"JZ_FSTX_XPJ"
													},{
														  fieldLabel: "纬度",
														  name:"JZ_FSTX_WD",
														  id:"JZ_FSTX_WD"
													},{
															fieldLabel: "百度纬度",
														  name:"BD_WD",
														  id:"BD_WD"
													}
												]
											},
											{
												layout:"form",
												defaultType:"displayfield",
												bodyStyle:'padding:15px 5px 0px 20px',
												defaults:{anchor:'92%',labelWidth:100,border:false},
												items:[
													{
														fieldLabel: "载频配置",
														name:"JZ_ZPPZ",
														id:"JZ_ZPPZ"
													},{
														 fieldLabel: "基站编号",
														 name:"JZ_BH",
														 id:"JZ_BH"
													},{
														fieldLabel: "天线增益",
														 name:"JZ_TXZY",
														id:"JZ_TXZY"
													}, {
														 fieldLabel: "发射天线类型",
														 name:"JZ_FSTX_LX",
														 id:"JZ_FSTX_LX"
													},{
														 fieldLabel: "架设高度(m)",
														 name:"JZ_FSTX_JSGD",
														 id:"JZ_FSTX_JSGD"
													}, {

														fieldLabel: "数量",
														 name:"JZ_FSTX_SL",
														 id:"JZ_FSTX_SL"
													}, {
														 fieldLabel: "基站名称",
														 name:"JZ_MC",
														 id:"JZ_MC"
													},{
														  fieldLabel: "设备区域",
														  name:"JZ_SB_QY",
														  id:"JZ_SB_QY"
													},{
															 fieldLabel: "百度经度",
														  name:"BD_JD",
														  id:"BD_JD"
													}, {
														  fieldLabel: "经度",
														  name:"JZ_FSTX_JD",
														  id:"JZ_FSTX_JD"
													}, {
														  fieldLabel: "地点",
														  name:"JZ_DD",
														  id:"JZ_DD"
													}
												]
											}
										]
									}
								]
							}
						]
					}, {
						title:'图片',
						xtype:"panel",
						id:"pic",
						bodyStyle:'padding:15px 5px 0px 10px',
						autoScroll : true,
						defaultType:"displayfield",
						defaults:{anchor:'92%',border:false},
						html:'<div id="picStr"></div>'
					}
	    		],
				listeners:{
					'tabchange':function(tabPanel, newCard, oldCard, eOpts){
						if(newCard.getId()=="pic"){
							Ext.Ajax.request({
								url: '${webctx}/doc_getDcfsDocmentListByCond.action',
								method: 'POST',
								params: {'dcfsDocument.jzsbbh':sbbh,'dcfsDocument.doctype':'图片'},
							 	callback: function (object, bool, response) {
									var jzsb_result=eval(response.responseText);
									var html="";
									var str;
									for(var i=0;i<jzsb_result.length;i++){
										str=jzsb_result[i].docurl.split("\\");
										html+="<img src='/doc/"+str[str.length-1]+"' width='95%' height='350' align='middle' /></br>";
									}
									document.getElementById("picStr").innerHTML=html;
							 	}
							});
						}
					}
				}
        	}
		]
   
       
    });
    
    var TSJL_JBXX_Win = new Ext.Window({
        id: "TSJL_JBXX_Win",
        layout: "fit",
        resizable: false,
        collapsible: false,
        closeAction: "hide",
        action: 'add',
        recordNum: -1,
        changeValue: -1,
        modal: true,
        autoDestroy: true,
        width:300,
        height:180,
        labelWidth:80,
        items:[
        	{
	        	xtype:'form',
	        	id:'dlxx_ggts_form',
	        	defaults:{anchor:'96%',border:false},
	        	bodyStyle:'padding:15px 5px 0px 5px',
	        	
	        	items:[
	        		{
		   				xtype: "textfield",
		   				fieldLabel: '&nbsp;&nbsp;&nbsp;投诉人',
		   				id:'TS_R',
		   				name:'dcfsGgtsJbxx.tsr'
		   			},{
		   				xtype: "textfield",
		   				fieldLabel: '投诉地点',
		   				id:'TS_DD',
		   				name:'dcfsGgtsJbxx.tsdd'
		   			},{
		   				xtype: "textfield",
		   				fieldLabel: '联系电话',
		   				id:'TS_LXDH',
		   				name:'dcfsGgtsJbxx.tsrlxdh'
		   			}
	        	]
        	}
        ],
        buttons:[
        	{
        		text:'添加',
        		handler:function(){
        			Ext.getCmp('dlxx_ggts_form').getForm().submit({
                        waitMsg : '正在提交表单数据,请稍候...',
						waitTitle : '正在验证数据...',
        				method:"POST",
                        url:"${webctx}/gisggts_insertDcfsGgtsJbxx.action",
                        params : { 'dcfsJzSbJbxx.jzsbbh':TS_SB_BH },
                        success:function(form,action){
                        	Ext.Msg.hide();
                            Ext.getCmp("sb_ts_grid").getStore().load({params:{'dcfsGgtsJbxx.tssbbh': TS_SB_BH}});
                            TSJL_JBXX_Win.hide();
                        },
                        failure:function(form,action){
                            Ext.Msg.alert("提示","操作出现了异常！");
                        }
        			});
        		}
        	},{
        		text:'关闭',
        		handler:function(){
        			TSJL_JBXX_Win.hide();
        		}
        	}
        ],
        listeners: {
            hide: function (w) {
                Ext.getCmp('dlxx_ggts_form').getForm().reset();
            }
        }
    });
    
    var TS_JL_Win = new Ext.Window({
        id: "TS_JL_Win",
        layout: "fit",
        resizable: false,
        collapsible: false,
        closeAction: "hide",
        autoDestroy: true,
        title:"投诉记录",
        width:450,
        height:300,
        items:[
        	{
        		xtype:"grid",
	            id:"sb_ts_grid",
	            bodyBorder:true,
	            border:true,
	            loadMask: true,
	            tbar:[
	            	{
	            		text:'添加投诉记录',
	            		handler:function(){
	            			TSJL_JBXX_Win.show();
	            		}
	            	}
	            ],
	            store: {
	                xtype: "jsonstore",
	                url:"${webctx}/gisggts_getDcfsGgtsJbxx_map.action",
	                root:"root",
	               // baseParams:{'dcfsGgtsJbxx.tssbbh':'1'},
	                fields: [
	                	{name:"TS_BH"},{name: "TS_SJ"},{name: "TS_R"},
	                	{name: "TS_DD"},{name: "TS_R_LXDH"},{name: "TS_SB_SSQY"},
	                	{name: "TS_SB_LX"},{name: "TS_SB_MC"},{name: "TS_SB_BH"},
	                	{name: "TS_QKMS"},{name: "TS_BZ"},{name: "TS_ZT"}
	                ]
	            },
				columns:[
					{header: '当前状态',width:100, dataIndex: 'TS_ZT', align: "left",sortable:true,
						renderer: function (value, p, record) {
							var fieldValue = value;
	                       	if(fieldValue=="未处理"){
	                       		fieldValue="<div style=\"color:red;font-weight:bold;\">未处理</div>";
	                       	}else {
	                       		fieldValue="<div style=\"color:green;font-weight:bold;\">已处理</div>";
	                       	}
	                       	return fieldValue;
                       	}
					},
					//{header: '名称',width:100, dataIndex: 'TS_BH', align: "left" },
					{header: '时间',width:250, dataIndex: 'TS_SJ', align: "center", sortable:true},					
					{header: '地点',width:100, dataIndex: 'TS_DD', align: "left" },
					{header: '联系人',width:100, dataIndex: 'TS_R', align: "left" },
					{header: '电话',width:100, dataIndex: 'TS_R_LXDH', align: "left" },
					{header: '所属区域',width:100, dataIndex: 'TS_SB_SSQY', align: "left" },
					{header: '设备类型',width:100, dataIndex: 'TS_SB_LX', align: "left" },
					{header: '设备名称',width:100, dataIndex: 'TS_SB_MC', align: "left" }
					//{header: '名称',width:100, dataIndex: 'TS_SB_BH', align: "left" },
					//{header: '名称',width:100, dataIndex: 'TS_QKMS', align: "left" },
					//{header: '名称',width:100, dataIndex: 'TS_BZ', align: "left" }
				]
        	}
        ],
        listeners: {
            hide: function (w) {
                Ext.getCmp("sb_ts_grid").getStore().removeAll();
                TS_SB_BH=null;
            }
        }
    });
    
    var record=new Ext.data.Record.create([
        { name: "MC" },
        { name: "ZB" },
        { name: "IN" }
    ]);

	//定义了组件类，窗口主要部分
	var MyViewport = Ext.extend(Ext.Viewport, {
		xtype: "viewport", 
		layout: 'fit',
		initComponent: function () {
			this.items = {
				xtype:"panel",
	            id:"dcfs_gbds_sb_panel",	            
	            layout: 'border',
	            border:false,
	            defaults: {
		            collapsible: true,
		            split: true
		        },
	            items:[
	            	{
			            title: '工具',
			            region: 'east',
			            //autoScroll: true,
			            //useArrows: false,
			            //animate: false,
			            //enableDD: false,
			            minSize: 300,
			            maxSize: 500,
			            width:320,
			            //autoScroll: true,
			            frame:true,
			            collapseMode: 'mini',
			            layout: {
                            type:'vbox',
                            padding:'1'
                        },
			            items:[
			            	{
			            		xtype:"form",
			            		flex:1,
			            		bodyStyle:'padding:15px 10px 0px 5px',
			            		labelWidth:70,
			            		height:250,
			            		defaults:{anchor:'96%',border:false},
			            		items:[
			            			{
			            				xtype: "combo",
				                        name: "CXLX",
				                        id: "CXLX",
				                        editable: false,
				                        triggerAction: 'all',
				                        fieldLabel: "类&nbsp;&nbsp;&nbsp;型",
				                        store: new Ext.data.SimpleStore({
				                            fields: [{ name: "LX_BH" }, { name: "LX_MC"}],
				                            data: [
												['0', "全部"],
												['1', "基站设备"],
												['153', "变电站"]
//				                                ['1', "广播电视"],
//				                                ['2', "基站设备"],
//				                                ['3', "输电线路"],
//				                                ['4', "变电站系统"],
//				                                ['5', "电磁辐射环境质量监测点"]
				                            ]
				                        }),
										value: '0',
				                        mode: 'local',
				                        valueField: 'LX_BH',
				                        displayField: 'LX_MC',
				                        selectOnFocus: true,
				                        emptyText: "请选择……"
			            			},
			            			{
			            				xtype: "textfield",
			            				fieldLabel: '地&nbsp;&nbsp;&nbsp;点',
			            				id:'address'
			            			},{
			            				xtype: "textfield",
			            				fieldLabel: '名&nbsp;&nbsp;&nbsp;称',
			            				id:'name'
			            			},
									{
										xtype: "textfield",
										fieldLabel: '建设年份',
										padding:'5 10 5 10',
										id:'year',
										listeners:{
											focus :function(){
													WdatePicker({dateFmt:'yyyy',maxDate:'%y'});
											}
										}
									},
									{
										xtype: "combo",
										editable:false,
										triggerAction:'all',
										fieldLabel: '运营单位',
										id:'build',
										name:"build",
										store:new Ext.data.JsonStore({
											fields:["yyid","yyname"],
											//root:'root',
											//url:"${webctx}/sbyt_getDcfsSbYtJbxxListByCond.action"
											data: [{"yyid":"","yyname":"全部"},{"yyid":"中国移动","yyname":"中国移动"},{"yyid":"中国联通","yyname":"中国联通"},{"yyid":"中国电信","yyname":"中国电信"}]
										}),
										mode:'local',
										valueField: 'yyid',
										displayField: 'yyname',
										value:"",
										selectOnFocus:true
									},
									{
										xtype: "textfield",
										fieldLabel: '环评单位',
										id:'check'
									},
			            			/*{
			            				xtype: "textfield",
			            				fieldLabel: '区&nbsp;&nbsp;&nbsp;域',
			            				id:'area'
			            			},*/
			            			{
			            				xtype: "combo",
				                        name: "JZ_SB_QY1",
				                        id: "JZ_SB_QY1",
				                        editable: false,
				                        triggerAction: 'all',
				                        fieldLabel: "区&nbsp;&nbsp;&nbsp;域",
				                        store: new Ext.data.SimpleStore({
				                            fields: [{ name: "XZQH_BH" }, { name: "XZQH_MC"}],
				                            data:data
				                        }),
				                        mode: 'local',
				                        valueField: 'XZQH_BH',
				                        displayField: 'XZQH_MC',
				                        selectOnFocus: true,
				                        value:-1
			            			}
			            		],
			            		buttons:[
			            			/*{
			            				text:"区域搜索",
			            				handler:function(){
			            					if(Ext.getCmp("area").getValue()!=""){
			            						local.search('"' + Ext.getCmp("area").getValue() + '"');
			            					}else {
			            						Ext.Msg.alert("提示", "区域不能为空");
			            					}
			            				}
			            			},*/
			            			{
			            				text:"搜索",
			            				handler:function(){
											Ext.getCmp("fsy_grid").getStore().removeAll();
											Ext.Msg.wait('查询中，请稍后...', '提示'); //进度条等待
											//名称参数
											var JZ_MC=Ext.getCmp("name").getValue();
											//地点参数
											var JZ_DD=Ext.getCmp("address").getValue();
											//建设年份
											var year = Ext.getCmp("year").getValue();
											//建设单位
											var build = Ext.getCmp("build").getValue();
											//检查单位
											var check = Ext.getCmp("check").getValue();
											var JZ_SB_QY=null;
											//区域参数
											if(Ext.getCmp("JZ_SB_QY1").lastSelectionText!="全市"){
												JZ_SB_QY=Ext.getCmp("JZ_SB_QY1").lastSelectionText;
											}
											//基站类型
											var JZ_LX = Ext.getCmp("CXLX").getValue();

											//alert(Ext.getCmp("JZ_SB_QY").lastSelectionText);
											Ext.Ajax.request({
												url: '${webctx }/gis_getGis.action',
												method: 'POST',
												params: { query:true,
													'dcfsJzSbJbxx.jzsbmc':JZ_MC,
													'dcfsJzSbJbxx.jzsbazwz':JZ_DD,
													'dcfsJzSbJbxx.jzsbqy':JZ_SB_QY,
													'dcfsJzSbJbxx.ytbh':JZ_LX,
													'dcfsJzSbJbxx.jzsbqysj':year,
													'dcfsJzSbJbxx.jzmc':build,
													'dcfsJzSbJbxx.jzjcdw':check
												},
												success: function (object, bool, response) {
													Ext.Msg.hide();
													var JZ_Points = Ext.util.JSON.decode(object.responseText);
													//往地图上添加覆盖物(标注)
													addMarker(JZ_Points);

												},
												failure: function (response) {
													Ext.Msg.alert("提示", "加载失败");
												}
											});
											/*if(JZ_Points!=null&&JZ_Points.length!=0){
														for ( var i = 0; i < JZ_Points.length; i++) {
															//alert(markerArr[i].name.indexOf(Ext.getCmp('name').getValue()));
															var fsyRecord=null;
															if(Ext.getCmp('address').getValue()!=''){
																if(JZ_Points[i].address.indexOf(Ext.getCmp('address').getValue())>0||JZ_Points[i].address.indexOf(Ext.getCmp('address').getValue())==0){
																	if(Ext.getCmp('name').getValue()!=''){
																		if(JZ_Points[i].name.indexOf(Ext.getCmp('name').getValue())>0||JZ_Points[i].name.indexOf(Ext.getCmp('name').getValue())==0){
																			fsyRecord=new record({
																				MC:JZ_Points[i].name,
																				ZB:JZ_Points[i].point,
																				IN:i
																			});
																			Ext.getCmp("fsy_grid").getStore().add(fsyRecord);
																		}
																	}else{
																		fsyRecord=new record({
																			MC:JZ_Points[i].name,
																			ZB:JZ_Points[i].point,
																			IN:i
																		});
																		Ext.getCmp("fsy_grid").getStore().add(fsyRecord);
																	}
																}
															}else{
																if(Ext.getCmp('name').getValue()!=''){
																	if(JZ_Points[i].name.indexOf(Ext.getCmp('name').getValue())>0||JZ_Points[i].name.indexOf(Ext.getCmp('name').getValue())==0){
																		fsyRecord=new record({
																			MC:JZ_Points[i].name,
																			ZB:JZ_Points[i].point,
																			IN:i
																		});
																		Ext.getCmp("fsy_grid").getStore().add(fsyRecord);
																	}
																}
															}
														}
													}*/
			            				}
			            			}
			            		]
			            	},{
			            		xtype:"grid",
					          	title:"搜索结果",
					            id:"fsy_grid",
					            bodyBorder:true,
					            border:true,
					            flex:5,
					            viewConfig: { forceFit: true },
					            store: {
					                xtype: "jsonstore",
					                fields: [
					                	{name:"MC"},{ name: "ZB"},{ name: "IN"}
					                ]
					            },
								columns:[
									{header: '名称',width:100, dataIndex: 'MC', align: "left" }
								],
								listeners: {
									"rowdblclick":function(g,recordNum,e) {
										var p0 = Ext.getCmp("fsy_grid").getStore().getAt(recordNum).get("ZB").split("|")[0];
            							var p1 = Ext.getCmp("fsy_grid").getStore().getAt(recordNum).get("ZB").split("|")[1];
            							var gpsPoint = new BMap.Point(p0 , p1);									
        								map.centerAndZoom(gpsPoint, 18);
        								//var iw = createInfoWindow(Ext.getCmp("fsy_grid").getStore().getAt(recordNum).get("IN"));
        								//markerArr[Ext.getCmp("fsy_grid").getStore().getAt(recordNum).get("IN")].click();
        								//map.maskLayer.click();
					                }
								}
			            	}
			            ]
			        },{
			            region: 'center',
			            collapsible: false,
			            contentEl:'dituContent'
			        }
	            ]
			}
			MyViewport.superclass.initComponent.call(this);
		}
	});

	//使用上边定义的组件类new出对象，渲染
	Ext.onReady(function(){
		var viewport = new MyViewport();
    	viewport.render();
	});
	
    //创建和初始化地图函数： width: 650px;height: 480px;
    function initMap(){ 
        createMap();//创建地图 
        setMapEvent();//设置地图事件 
        addMapControl();//向地图添加控件 
		//在地图上初始化五个示范点
        Load_Point();
    }
    //创建地图函数：
    var local;
    function createMap() {
        var map = new BMap.Map("dituContent"); //在百度地图容器中创建一个地图 
        var point = new BMap.Point(114.325111,30.546878); //定义一个中心点坐标 
        map.centerAndZoom(point, 14); //设定地图的中心点和坐标并将地图显示在地图容器中 
        window.map = map; //将map变量存储在全局 
        local = new BMap.LocalSearch(map, {
            renderOptions: { map: map, selectFirstResult: false
            }
        });

     }
     //地图事件设置函数： 
    function setMapEvent() {
        map.enableDragging(); //启用地图拖拽事件，默认启用(可不写) 
        map.enableScrollWheelZoom(); //启用地图滚轮放大缩小 
        map.enableDoubleClickZoom(); //启用鼠标双击放大，默认启用(可不写) 
        map.enableKeyboard(); //启用键盘上下左右键移动地图 
    }
    //地图控件添加函数： 
    function addMapControl() {
        //向地图中添加缩放控件
        var ctrl_nav = new BMap.NavigationControl({
            anchor: BMAP_ANCHOR_TOP_LEFT,
            type: BMAP_NAVIGATION_CONTROL_LARGE
        });
        map.addControl(ctrl_nav);
        //向地图中添加缩略图控件 
        var ctrl_ove = new BMap.OverviewMapControl({
            anchor: BMAP_ANCHOR_BOTTOM_RIGHT,
            isOpen: 1
        }); map.addControl(ctrl_ove); //向地图中添加比例尺控件 
        var ctrl_sca = new BMap.ScaleControl({
            anchor: BMAP_ANCHOR_BOTTOM_LEFT
        });
        map.addControl(ctrl_sca);
        map.addControl(new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP,BMAP_HYBRID_MAP]}));
    }
    var markerArr=null;
	/*var markerArr = [
		{
	        title: "<span>测长试点</span>",
	        content: "xxx：<br/>xxx <br/>xxx",
	        point: "129.621894|44.586801",
	        isOpen: 1,
	        name:"测长试点",
	        icon: { w: 60, h: 60, l: 0, t: 1, x: 6, lb: 9 },
	        type:1
	    }, {
	        title: "<span>长久药业</span>",
	        content: "企业编号：HB00104239<br/>" +
	        "企业名称：长久药业<br/>" +
	        "详细地址：武汉市光谷大道110号<br/>" +
	        "联系电话：027-86877901<br/>" +
	        "<br/><a href='javascript:void(0)' onclick='loadSBXX(1)'>详细情况</a><br/><br/>" +
	        "<a href='javascript:void(0)' onclick='loadTSXX(1,1)'>投诉信息</a><br/><br/>" +
	        "<a href='javascript:void(0)' onclick='loadMGD(1,129.628273,44.592441)'>周围敏感点</a>" ,
	        point: "129.628273|44.592441",
	        name:"长久药业",
	        isOpen: 1,
	        icon: { w: 60, h: 60, l: 0, t: 1, x: 6, lb: 9 },
	        type:2
	    }
	];*/
	var sbbh;



	//点击标签中的详细信息执行的方法
	function loadSBXX(type,SB_BH){      
        var urlpath="";
        sbbh=SB_BH;
		switch (type) {
			case 1:
				Ext.getCmp("SB_JBXX_Win").setSize(600,380);
            	urlpath="${webctx }/dcfs_dlxx/dcfs_gbds_sb_win.jsp";
				break;
			case 2:
			//Ext.getCmp("SB_JBXX_Win").setSize(600,380);
			var extAjax = Ext.Ajax;
	        extAjax.request({
	            url: '${webctx }/gis_getJzsbJbxx.action',
	            method: 'POST',
	            params: { 'dcfsJzSbJbxx.jzsbbh':SB_BH },
				callback: function (object, bool, response) {
					Ext.Msg.hide();
					Ext.getCmp("SB_JBXX_Win").setSize(600,380);
					Ext.getCmp('SB_JBXX_Win').show();
					Ext.getCmp('SB_JBXX_Win').action='add';
					Ext.getCmp('SB_JBXX_Win').center();
					Ext.getCmp("JZ_SB_BH").setValue(response.responseText.split(":'")[1].split("',")[0]);
					Ext.getCmp("JZ_SB_MC").setValue(response.responseText.split(":'")[2].split("',")[0]);
					Ext.getCmp("JZ_SB_XH").setValue(response.responseText.split(":'")[3].split("',")[0]);
					Ext.getCmp("JZ_SB_WLLX").setValue(response.responseText.split(":'")[4].split("',")[0]);
					Ext.getCmp("JZ_SB_AZWZ").setValue(response.responseText.split(":'")[7].split("',")[0]);
					Ext.getCmp("JZ_SB_QYSJ").setValue(response.responseText.split(":'")[8].split("',")[0]);
					Ext.getCmp("JZ_BCGL").setValue(response.responseText.split(":'")[9].split("',")[0]);
					Ext.getCmp("JZ_ZPPZ").setValue(response.responseText.split(":'")[10].split("',")[0]);
					Ext.getCmp("JZ_XXPD_1").setValue(response.responseText.split(":'")[11].split("',")[0]);
					Ext.getCmp("JZ_XXPD_2").setValue(response.responseText.split(":'")[12].split("',")[0]);
					Ext.getCmp("JZ_TXZY").setValue(response.responseText.split(":'")[13].split("',")[0]);
					Ext.getCmp("JZ_FSTX_LX").setValue(response.responseText.split(":'")[14].split("',")[0]);
					Ext.getCmp("JZ_FSTX_JHFS").setValue(response.responseText.split(":'")[15].split("',")[0]);
					Ext.getCmp("JZ_FSTX_FWJ").setValue(response.responseText.split(":'")[16].split("',")[0]);
					Ext.getCmp("JZ_FSTX_XPJ").setValue(response.responseText.split(":'")[17].split("',")[0]);
					Ext.getCmp("JZ_FSTX_JD").setValue(response.responseText.split(":'")[18].split("',")[0]);
					Ext.getCmp("JZ_FSTX_WD").setValue(response.responseText.split(":'")[19].split("',")[0]);
					Ext.getCmp("JZ_FSTX_JSFS").setValue(response.responseText.split(":'")[20].split("',")[0]);
					Ext.getCmp("JZ_FSTX_JSGD").setValue(response.responseText.split(":'")[21].split("',")[0]);
					Ext.getCmp("JZ_FSTX_SL").setValue(response.responseText.split(":'")[22].split("',")[0]);
					Ext.getCmp("JZ_BZ").setValue(response.responseText.split(":'")[23].split("',")[0]);
					Ext.getCmp("JZ_BH").setValue(response.responseText.split(":'")[24].split("',")[0]);
					Ext.getCmp("JZ_MC").setValue(response.responseText.split(":'")[25].split("',")[0]);
					Ext.getCmp("JZ_DD").setValue(response.responseText.split(":'")[26].split("',")[0]);
					Ext.getCmp("BD_JD").setValue(response.responseText.split(":'")[27].split("',")[0]);
					Ext.getCmp("BD_WD").setValue(response.responseText.split(":'")[28].split("',")[0]);
					Ext.getCmp("JZ_HP_ZT").setValue(response.responseText.split(":'")[29].split("',")[0]);
					Ext.getCmp("JZ_YS_DW").setValue(response.responseText.split(":'")[30].split("',")[0]);
					Ext.getCmp("JZ_YYS_XX").setValue(response.responseText.split(":'")[31].split("',")[0]);
					Ext.getCmp("JZ_JC_DW").setValue(response.responseText.split(":'")[32].split("',")[0]);
					Ext.getCmp("JZ_SB_QY").setValue(response.responseText.split(":'")[33].split("'")[0]);

			   	},
	            failure: function (response) {
	                Ext.Msg.alert("提示", "加载失败");
	            }
	        });
				//Ext.getCmp('SB_JBXX_Win').show();
		       // Ext.getCmp('SB_JBXX_Win').load({scripts:true,params:{SB_BH:SB_BH,loaditem:"add"}});
				break;
		}
        return false;
	}
	var TS_SB_BH=null;
	function loadTSXX(SB_BH){
		TS_JL_Win.show();
		TS_SB_BH=SB_BH;
		Ext.getCmp("sb_ts_grid").getStore().load({params:{'dcfsGgtsJbxx.tssbbh': SB_BH}});
		return false;
	}
	//加载敏感点
	function loadMGD(SB_BH,jd,wd){
		//alert(document.getElementById("leibie").value);
		var mPoint = new BMap.Point(jd, wd);  
		var circle = new BMap.Circle(mPoint,1000,{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.3, strokeOpacity: 0.3});
		map.addOverlay(circle);
		local = new BMap.LocalSearch(map, {renderOptions: {map:map,selectFirstResult:false, autoViewport:true,panel:"results"}});
		local.searchNearby(document.getElementById("leibie").value, circle.getCenter(), circle.getRadius());
		
		/*var extAjax = Ext.Ajax;
        extAjax.request({
            url: 'gis_getJzsbMgdJbxx.action',
            method: 'POST',
            params: { 'dcfsHjjcdJbxx.jzsbbh':SB_BH },
            success: function (object, bool, response) {
            	var res = Ext.util.JSON.decode(object.responseText);
            	addMarker(res);
            },
            failure: function (response) {
                Ext.Msg.alert("提示", "加载失败");
            }
        });*/
		return false;
	}

	function loadRealTimeData(bdzCode){
		Ext.Ajax.request({
			url: '${webctx }/bdzRealTimeData/bdzRealTimeData/getRealTimeListByCond.action',
			method: 'POST',
			params: { query:true,
				'bdzCode': bdzCode,
				'startRowNum':0,
				'endRowNum':1
			},
			success: function (object, bool, response) {
				Ext.Msg.hide();
				var bdzs = Ext.util.JSON.decode(object.responseText).root;
				var bdz = bdzs[0];
				document.getElementById("mesure_"+bdzCode).innerText= bdz.mesure+'V/m';//电场
				document.getElementById("mesure2_"+bdzCode).innerText= bdz.mesure2+'μT';//磁场
				document.getElementById("isMesureValid_"+bdzCode).innerText= bdz.isMesureValid;//电场是否达标
				document.getElementById("isMesure2Valid_"+bdzCode).innerText= bdz.isMesure2Valid;//磁场是否达标
				document.getElementById("temperature_"+bdzCode).innerText= bdz.temperature+'℃';
				document.getElementById("humidity_"+bdzCode).innerText= bdz.humidity+'%';
			},
			failure: function (response) {
				document.getElementById("mesure_"+bdzCode).innerText= "";//电场
				document.getElementById("mesure2_"+bdzCode).innerText= "";//磁场
				document.getElementById("isMesureValid_"+bdzCode).innerText= "";//电场是否达标
				document.getElementById("isMesure2Valid_"+bdzCode).innerText= "";//磁场是否达标
			}
		});
	}

	var timerId = "";

    //创建marker,添加标注
    function addMarker(markerArr1) {

		//1.将搜索结果呈现在页面右下角的列表中
		//1.1
		Ext.getCmp("fsy_grid").getStore().removeAll();
		if(markerArr1!=null){
			for ( var i = 0; i < markerArr1.length; i++) {
				//alert(markerArr[i].name.indexOf(Ext.getCmp('name').getValue()));
				var fsyRecord = new record({
					MC:markerArr1[i].name,
					ZB:markerArr1[i].point,//经纬度
					IN:i
				});
				Ext.getCmp("fsy_grid").getStore().add(fsyRecord);
			}
		}
		//2.往地图上添加标注
		//2.1先清除地图上已有覆盖物
		var allOverlay = map.getOverlays();
		for (var i = 0; i < allOverlay.length ; i++) {
			map.removeOverlay(allOverlay[i]);//清除已有标注
		}
		//2.2往地图上添加覆盖物
        for (var i = 0; i < markerArr1.length; i++) {
            var json = markerArr1[i];
            var p0 = json.point.split("|")[0];
            var p1 = json.point.split("|")[1];
            var point = new BMap.Point(p0,p1);
            var iconImg = createIcon(json.icon,json.type);
			var marker = new BMap.Marker(point, { icon: iconImg });//创建标注
			//label是标注旁边的小方框，里边填入文字
            var label = new BMap.Label(json.title, { "offset": new BMap.Size(json.icon.lb - json.icon.x + 33, -0) });
			label.setStyle({ borderColor: "#808080", color: "#333", cursor: "pointer" });
			marker.setLabel(label);
			map.addOverlay(marker);// 将标注添加到地图中


			(function () {
				var _iw = createInfoWindow(markerArr1,i);
                var _marker = marker;
				//点击标注时触发
				_marker.addEventListener("click", function () {
                    this.openInfoWindow(_iw);
					var sbbh = _iw.yhuso_sbbh;//设备编号
					var sblx = _iw.yhuso_sblx;//153为变电站 0为基站设备
					if (sblx == 153) {
						loadRealTimeData(sbbh);
						timerId = setInterval("loadRealTimeData('" + sbbh + "')", 5000);
					}
                });
                _iw.addEventListener("open", function () {
					_marker.getLabel().hide();//2
				});
                _iw.addEventListener("close", function () {
					if(timerId!="") {
						clearInterval(timerId);
					}
					_marker.getLabel().show();//3

				});
				//label指的是搜索出来的名称小方框，点击以后弹窗
                label.addEventListener("click", function () {
					_marker.openInfoWindow(_iw);//1
					var sbbh = _iw.yhuso_sbbh;//设备编号
					var sblx = _iw.yhuso_sblx;//153为变电站 0为基站设备
					if (sblx == 153) {
						loadRealTimeData(sbbh);
						timerId = setInterval("loadRealTimeData('" + sbbh + "')", 5000);
					}
				});
                if (!!json.isOpen) {
                    label.hide();
					_marker.openInfoWindow(_iw);
                } 
            })()
        }

    }
    
    function gpstobd(points){
    	/*for (var i = 0; i < markerArrs.length; i++) {
            var json = markerArrs[i];
            //var p0 = json.point.split("|")[0];
            //var p1 = json.point.split("|")[1];
            var gpsPoint = new BMap.Point(points[i].x,points[i].y);
	    	var marker = new BMap.Marker(gpsPoint, { icon: iconImg });;
	        var iconImg = createIcon(json.icon,json.type);
	        var iw = createInfoWindow(markerArrs,i);
	        var label = new BMap.Label(json.title, { "offset": new BMap.Size(json.icon.lb - json.icon.x + 23, -53) });
	        marker.setLabel(label);
	        map.addOverlay(marker);
	        label.setStyle({ borderColor: "#808080", color: "#333", cursor: "pointer" });
	        (function () {
	            var index = i; var _iw = createInfoWindow(markerArrs,i);
	            var _marker = marker; _marker.addEventListener("click", function () {
	                this.openInfoWindow(_iw);
	            });
	            _iw.addEventListener("open", function () { _marker.getLabel().hide(); });
	            _iw.addEventListener("close", function () { _marker.getLabel().show(); });
	            label.addEventListener("click", function () { _marker.openInfoWindow(_iw); });
	            if (!!json.isOpen) {
	                label.hide(); _marker.openInfoWindow(_iw);
	            } 
	        })()
        }*/
    }
    //创建InfoWindow 
    function createInfoWindow(markerArr1,i) {
        var json = markerArr1[i];
		var opts = {
			width : 290,     // 信息窗口宽度
			height: 210,     // 信息窗口高度
			title : json.title  // 信息窗口标题
		};
		var iw = new BMap.InfoWindow("<div class='iw_poi_content'>" + json.content + "</div>", opts);
		iw.yhuso_sbbh = json.sbbh;
		iw.yhuso_sblx = json.sblx;
        return iw;
    }
    //创建一个Icon 
    function createIcon(json,t) {
    	var icon;
		var imgName;
    	if(t==1){
			imgName = "dcfs.jpg";
    	}else if(t==2){
			imgName = "shudian.png";
		}else if(t==3){
			imgName = "dianchi.png";
		}else{
			imgName = "biandianzhan.png";
		}
		icon = new BMap.Icon("${webctx }/images/dcfs/"+imgName, new BMap.Size(json.w, json.h), { imageOffset: new BMap.Size(-json.l, -json.t), infoWindowOffset: new BMap.Size(json.lb + 5, 20), offset: new BMap.Size(json.x, json.h) });
		return icon;
    }

    var content=1;
    var JZ_Points=null;

    function Load_Point(){
		Ext.Ajax.request({
			url: '${webctx }/gis_getGis.action',
			method: 'POST',
			params: {
				query:true,
				'dcfsJzSbJbxx.ytbh': '2'
			},
			success: function (object, bool, response) {
				var JZ_Points = Ext.util.JSON.decode(object.responseText);
				//往地图上添加覆盖物(标注)
				addMarker(JZ_Points);
			},
			failure: function (response) {
				//Ext.Msg.alert("提示", "加载失败");
			}
		});
    }

    function loadQJDT(jd,wd,mc){
    	//Ext.getCmp('ManCenterPanel').body.update('<iframe id="qjdtmain" name="qjdtmain"  width="100%" height="100%" scrolling="auto" frameborder="0"   src="${webctx }/dcfs_dlxx/dcfs_dlxx_main.jsp"></iframe>');
    	var url="${webctx }/dcfs_qjdt/dcfs_qjdt.jsp?jd="+jd+"&wd="+wd+"&mc="+encodeURI(encodeURI(mc));
    	window.open (url,'newwindow','height=500,width=800,top=100,left=100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
    }
    function loadMXFX(jd,wd,mc,bcgl){
    	//Ext.getCmp('ManCenterPanel').body.update('<iframe id="qjdtmain" name="qjdtmain"  width="100%" height="100%" scrolling="auto" frameborder="0"   src="${webctx }/dcfs_dlxx/dcfs_dlxx_main.jsp"></iframe>');
    	var url="${webctx }/dcfs_mxfx/dcfsMain.jsp?jd="+jd+"&wd="+wd+"&mc="+encodeURI(encodeURI(mc))+"&bcgl="+bcgl;
    	window.open (url,'newwindow','height=650,width=1000,top=100,left=100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
    }
	initMap(); //创建和初始化地图http://openapi.baidu.com/map/images/us_mk_icon.png
</script>
</body>
</html>